<?php
echo $javascript->link('jquery.tablePagination');
echo $javascript->link('jquery.tablesorter.min');
echo $html->css('tablePaginator');
?>
<script type="text/javascript" >
var $j = jQuery.noConflict();
$j(document).ready(function() {
    var options = {
              currPage : 1,
              //ignoreRows : $j('tbody tr:odd', $j('#tablapedidosdia')),
              optionsForRows : [5,10,15],
              rowsPerPage : 10,
              firstArrow : (new Image()).src="../img/paginator/first.gif",
              prevArrow : (new Image()).src="../img/paginator/prev.gif",
              lastArrow : (new Image()).src="../img/paginator/last.gif",
              nextArrow : (new Image()).src="../img/paginator/next.gif",
              topNav : false
            }
            $j('#tablelistadmin').tablePagination(options);

    $j(function(){
      $j("#tablelistadmin").tablesorter();
    });



    function ordenCss(){
        var table = document.getElementById('tablelistadmin');
        var allTRs = table.getElementsByTagName("tr");
        for (i=1; i <= allTRs.length ; i++) {
        if (i % 2 == 1)
        allTRs[i].style.backgroundColor = "#eeeeee";
        }
    };

$j('#tablelistadmin tr').click(function(){     //function_td
      //$(this).css("font-weight","bold");
      //e.stopPropagation();
      //alert("yeah");
      ordenCss();
    });

});


</script>
<!--<div class="menu bubplastic horizontal aqua">
		<ul>
			<li><span class="menu_r"><a href="/pronto/admins/index" target="_self"><span class="menu_ar">Pedidos</span></a></span></li>
			<li><span class="menu_r"><a href="/pronto/productos/index" target="_self"><span class="menu_ar">Productos</span></a></span></li>
			<li><span class="menu_r"><a href="/pronto/datos/index" target="_self"><span class="menu_ar">Datos Empresa</span></a></span></li>
			<li><span class="menu_r"><a href="/pronto/clientes/index" target="_self"><span class="menu_ar">Clientes</span></a></span></li>
			<li><span class="menu_r"><a href="/pronto/sugerencias/index"><span class="menu_ar">Sugerencias</span></a></span></li>
			<li class="highlight"><span class="menu_r"><a href="/pronto/users/adminIndex"><span class="menu_ar">Usuarios</span></a></span></li>
			<li onclick="Modalbox.show('/pronto/clientes/adminAdd', {title:'', width: 540, height:500}); return false;"><span class="menu_r"><a><span class="menu_ar">Nuevo Usuario</span></a></span></li>
		</ul>
		<br class="clearit" />
</div> -->

<div id="contenadministradores" class="contenadministradores">
	<div id="labelcontent" class="labelcontent">
		<?php echo "Control de Usuarios Administradores";?>
	</div>
	<div id="listadministradores" class="listadministradores">
		<?php 
			if (empty($administradores)){
				echo "<div class='nolistaadmin'>"."No hay usuarios administradores registrados"."</div>";
			}
			else{
				echo "<div id='formbuscaclient' class='formbuscacliente'>";
					echo $form->create('Cliente',array('controller'=>'clientes','action'=>'search'));
					echo "<div class='labelbuscaliente'>";
					echo $form->input('q',array('label'=>'Buscar por C&eacute;dula:','class'=>'entradabuscar'));
					echo "</div>";
					echo "<div class='buttonbuscacliente'>";
					echo $form->button('Buscar',array('type'=>'submit','class'=>'botonbuscar'));
					echo "</div>";
					echo $form->end();
				echo "</div>";	

                                /*
				echo "<div class='barrasadmin'>";
					echo "<div class='titunombreadmin'>"."Nombre"."</div>";
					echo "<div class='titucedulaadmin'>"."C&eacute;dula"."</div>";
					echo "<div class='tituemailadmin'>"."E-mail"."</div>";
					echo "<div class='titusexoadmin'>"."Sexo"."</div>";
					echo "<div class='titutelefonoadmin'>"."Tel&eacute;fono(s)"."</div>";
					
					echo "<div class='titu1tipoadmin'>"."Tipo Usuario"."</div>";
					
					echo "<div class='titu1accionadmin'>"."Elminar"."</div>";
				echo "</div>";
				*/
				echo "<div  class='separatotalclientes'></div>";
				echo "<table class='tablapedidosdia' id='tablelistadmin'>";
                                    echo "<thead>";
                                        echo "<tr>";
                                            echo "<th>Nombre</th>";
                                            echo "<th>C&eacute;dula</th>";
                                            echo "<th>E-mail</th>";
                                            echo "<th>Sexo</th>";
                                            echo "<th>Tel&eacute;fono</th>";
                                            echo "<th>Tipo Usuario</th>";
                                            echo "<th>Eliminar</th>";
                                        echo "</tr>";
                                    echo "</thead>";
                                    echo "<tbody>";
					foreach($administradores as $administrador)
					{
						echo "<tr class='contenidolistaadmin'>";
							echo "<td class='tdlistanombreadmin'>";
								echo $administrador['User']['nombre'];
							echo "</td>";
							echo "<td class='tdlistacedulaadmin'>";
								echo $administrador['User']['username'];
							echo "</td>";
							echo "<td class='tdlistamailadmin'>";
								echo $administrador['Cliente']['mail'];
							echo "</td>";
							echo "<td class='tdlistasexoadmin'>";
								if($administrador['Cliente']['sexo']=="Femenino"){
									echo "F";
								}
								else{
									echo "M";
								}
							echo "</td>";
							echo "<td class='tdlistatelefonoadmin'>";
								echo $administrador['Cliente']['telefono']."<br/>".$administrador['Cliente']['celular'];
							echo "</td>";
							
							if($administrador['User']['admin']==1){
							echo "<td class='tdlistatelefonoadmin'>";
								echo "Administrador";
							echo "</td>";
							}else{
								echo "<td class='tdlistatelefonoadmin'>";
								echo "Usuario";
							echo "</td>";
							}
							
							echo "<td class='tdlistclientaccion'>";
								echo $html->link($html->image('botonEliminar.jpg'),array('controller'=>'clientes','action'=>'adminDelete',$administrador['User']['id']),null,'¿Estas Seguro?',array('escape'=>false));
							echo "</td>";
						echo "</tr>";
					}
                                     echo "</tbody>";
				echo "</table>";
			}
		?>
	</div>
	<?php echo "<div  class='separatotalclientes' style='margin-top:15px'></div>"; ?>
</div>
                <script>
    var table = document.getElementById('tablelistadmin');
    var allTRs = table.getElementsByTagName("tr");
    for (i=1; i <= allTRs.length ; i++) {
    if (i % 2 == 1)
    allTRs[i].style.backgroundColor = "#eeeeee";
    }
</script>